リンク集: Webブラウザのfetch()でReadableStreamをアップロードする機能の情報をまとめたい場所
#FetchUploadStreaming #ストリーミング #WebブラウザのJavaScript #JavaScript #upload
「ブラウザのJavaScriptでPOSTリクエストのBodyをストリーミングしたいが、Chromeも未対応みたい」で触れていたが、もう少し各種リンクに飛びやすくまとめたい場所。
現状、上記で触れている通りどのよく使われているブラウザでも任意のReadaableStreamがアップロードできる機能は実装されていない。
情報が知れるリンク集
仕様: Fetch Standard
whatwag: Uploading a Request made from a ReadableStream body by yutakahirano · Pull Request #425 · whatwg/fetch
Web Platform Tests
https://github.com/web-platform-tests/wpt/blob/34dcd2f398a1bc4a07d7b07db9b68ce1817ecd39/fetch/api/basic/request-upload.any.js
Mozilla/Apple/Googleが興味があると情報:
詳細: Service Worker WG TPAC 2019 - Google Docs
Chromiumで実装のコミットが確認できる: 688906 - Streaming upload support - chromium
Chromium Design doc: fetch() upload streaming
Chromiumでのフラグ名: FetchUploadStreaming
Experimentalフラグになった!
fetch Enable origin trial with AllowHTTP1ForStreamingUpload property. · chromium/chromium@4c75c0c
MacならGoogle Chrome Canaryで以下のようにして試せる。
まずchrome://flags/に行き、「Experimental Web Platform features」を調べて「Enabled」にする。
https://gyazo.com/3bdd47937d2c437b709e960dc50aeb19
そのあとに以下のように起動した。
code:bash
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-features=FetchUploadStreaming
(Runtime Enabled Featuresについて: Runtime Enabled Features)
現在のところ、HTTP/1でもこの機能を使うならfetch(..., {..., allowHTTP1ForStreamingUpload: true})という風にfetch()にプロパティをつけることで可能。temporal propertyとのことなのでいずれなくなるはず。
fetch() upload streaming - Chrome Platform Status
web.dev: Streaming requests with the fetch API
この機能が使っているブラウザで実装されたことを調べる
Feature detecting request stream bodies · Issue #1275 · whatwg/fetch
fetch()のPOSTでbodyをReadableStreamにできるか確認するNipp
Firefox
Standards Position: fetch streaming upload · Issue #663 · mozilla/standards-positions
1387483 - Meta-Bug Support ReadableStream as Request.body in fetch API
1469359 - Support ReadableStream as Request.body in fetch API in necko
Safari
Standars Poition: Fetch streaming upload · Issue #24 · WebKit/standards-positions
203617 – "ReadableStream uploading is not supported" when fetch()ing a Request that has been logged to console
Chromiumベースのブラウザがfetch() upload streamingに対応したバージョン | Edge, Brave, Vivaldi, Opera